<?php
namespace app\index\controller;
use think\Controller;
use think\Db;

class Login extends Controller {
    //处理用户信息
    public function index(){
        $ticket = input('Ticket','');
        if(!$ticket){
            $this->error('出错');
        }
        $MallcooApi = new MallcooApi();
        $userinfo = $MallcooApi->GetTokenByTicket($ticket);
        $userinfo = $MallcooApi->GetCardInfoByUserId($userinfo['Data']['OpenUserId']);
        session('card_id',$userinfo['Data']['ThirdPartyCardID']);
        session('userinfo',$userinfo['Data']);
        
        /*if($userinfo['Code'] != 1){
            $this->error($userinfo['Message']);
        }*/
        $this->redirect('index/index/index');
    }
}
